class Magic{
   static  init(animationElement,clickElement){
    let mbtn=clickElement;
    let box=animationElement;
    for (const element of mbtn) {
     let items=element.children;
    for (const item of items) {
       item.addEventListener("click",function(){
           let _this=this;
           this.style.backgroundColor="#FC297F"
           let animation_name=this.textContent.toLowerCase();
           box.classList.remove(animation_name);
           box.addEventListener("animationend",function(){
               this.classList.remove(animation_name)
           })
          box.classList.toggle(animation_name);
          setTimeout(function(){
            _this.style.removeProperty("background-color"); 
          },500)
       }) 
      
    }
    }
   }

}
export {Magic};